/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.dao.hibernate;

import com.click.app.dao.PhoneDao;
import com.click.app.model.Person;
import com.click.app.model.Phone;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author ariel
 */
public class PhoneDaoHibernate extends GenericDaoHibernate<Phone, Long> implements PhoneDao{

    public PhoneDaoHibernate() {
        super(Phone.class);
    }

    public List<Phone> findByPerson(Person person) {
        List<Phone> phones = getHibernateTemplate().find("from Phone where person=?", person);
        if(!phones.equals(null))
            return phones;
        else
            return new ArrayList<Phone>();
    }

}
